home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / packet / terminal / top_152 / src152.exe / rar / TOPFILE.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-16  |  24KB  |  923 lines

  1. {┌─────────────────────────────────────────────────────────────────────────┐}
  2. {│                                                                         │}
  3. {│                              T. O. P.                                   │}
  4. {│                                                                         │}
  5. {│                        (T)he  (O)ther  (P)acket                         │}
  6. {│                                                                         │}
  7. {│ T O P F I L E . P A S                                                   │}
  8. {│                                                                         │}
  9. {│                                                                         │}
  10. {│ Verschiedene Dateibehandlungen                                          │}
  11. {└─────────────────────────────────────────────────────────────────────────┘}
  12.  
  13.  
  14. Function  Compute_CRC (* CRC : Integer; Zeile : String) : Integer *);
  15. Var     i,i1 : Byte;
  16.         C    : Integer;
  17. Begin
  18.   C := CRC;
  19.   for i := 1 to length(Zeile) do
  20.   begin
  21.     i1 := Ord(Zeile[i]);
  22.     asm  mov al, i1;
  23.          mov bx, C;
  24.          mov cx, 8;
  25. @schleif:
  26.          rcl al, 1;
  27.          rcl bx, 1;
  28.          jnc @not_xor;
  29.          xor bx, $1021;
  30. @not_xor:
  31.          loop @schleif;
  32.          mov C, bx;
  33.     end;
  34.   end;
  35.   Compute_CRC := C;
  36. End;
  37.  
  38.  
  39. Procedure FileInfo (* Kanal,Art : Byte; Groesse,Count,tGroesse,tCount : LongInt *);
  40. Const  ArtStr  : Array[0..2] of String[2] = ('Rx','Tx','7+');
  41.  
  42. Var    i,Proz  : Byte;
  43.        Lstr    : String[2];
  44.        Bstr,
  45.        Tstr,
  46.        CoStr,
  47.        GrStr   : String[8];
  48.        Hstr    : String[78];
  49.        AufFlag : Boolean;
  50.        ChStr   : String[6];
  51.  
  52.    Function BinFlag(Art,TxRx_Bin : Byte) : Char;
  53.    Begin
  54.      if Art = 1 then
  55.      begin
  56.        Case TxRx_Bin of
  57.          1 : BinFlag := 'T';
  58.          2 : BinFlag := 'B';
  59.          5 : BinFlag := 'A';
  60.        end;
  61.      end else
  62.      begin
  63.        Case TxRx_Bin of
  64.          0 : BinFlag := 'T';
  65.          1 : BinFlag := 'B';
  66.          2,
  67.          3 : BinFlag := 'A';
  68.        end;
  69.      end;
  70.    End;
  71.  
  72. Begin
  73.   with K[Kanal]^ do
  74.   begin
  75.     if not BackScroll(Kanal) and (DateiInfo > 0) and
  76.        not(((RX_Save or FileSend) and SplSave) and (Art = 2)) then
  77.     begin
  78.       AufFlag := Aufwaerts;
  79.       case Art of
  80.         0 : begin     (* File-Rx *)
  81.               Hstr := FName_aus_FVar(RxFile);
  82.               Tstr := Rx_Time;
  83.               Bstr := int_str(RX_Count);
  84.               if RX_Bin in [1,2] then AufFlag := true;
  85.               ChStr := B1 + LRK + BinFlag(1,RX_Bin) + RRK;
  86.             end;
  87.         1 : begin     (* File-Tx *)
  88.               Hstr := FName_aus_FVar(TxFile);
  89.               Tstr := Tx_Time;
  90.               Bstr := int_str(TX_Count);
  91.               ChStr := B1 + LRK + BinFlag(2,TX_Bin) + RRK;
  92.             end;
  93.         2 : begin     (* 7+ Rx *)
  94.               Hstr := FName_aus_FVar(SplFile);
  95.               Tstr := Spl_Time;
  96.               Bstr := int_str(tCount);
  97.               if SplCountLines then
  98.               begin
  99.                 Groesse := Groesse div 69;
  100.                 Count := Count div 69;
  101.               end;
  102.             end;
  103.       end;
  104.  
  105.       Lstr := copy(Hstr,1,2);
  106.       Tstr := Time_Differenz(Tstr,Uhrzeit);
  107.       Bstr := FileBaud(Tstr,Bstr);
  108.  
  109.       if Groesse > 0 then
  110.       begin
  111.         Proz := Byte(Round((Count / Groesse) * 100));
  112.         if Proz > 100 then Proz := 100;
  113.         if (Proz = 100) and (Count < Groesse) then Proz := 99;
  114.         GrStr := SFillStr(8,B1,int_str(Groesse));
  115.       end else
  116.       begin
  117.         Proz := 0;
  118.         GrStr := B1 + ConstStr('-',6) + B1;
  119.       end;
  120.  
  121.       if Art = 2 then
  122.       begin
  123.         if tGroesse > 0 then
  124.         begin
  125.           i := Byte(Round((tCount / tGroesse) * 100));
  126.           if i > 100 then i := 100;
  127.           if (i = 100) and (tCount < tGroesse) then i := 99;
  128.         end else i := 0;
  129.         ChStr := SFillStr(6,B1,LRK + int_str(i) + '%' + RRK);
  130.         Lstr := '';
  131.       end;
  132.  
  133.       While pos(BS,Hstr) > 0 do delete(Hstr,1,pos(BS,Hstr));
  134.       Hstr := ArtStr[Art] + ChStr + B1 + Lstr + EFillStr(13,B1,Hstr);
  135.  
  136.       if AufFlag then CoStr := SFillStr(8,B1,int_str(Count))
  137.                  else CoStr := SFillStr(8,B1,int_str(Groesse - Count));
  138.  
  139.       i := Proz div 10;
  140.       Hstr := Hstr + SFillStr(3,B1,int_str(Proz)) + '%>';
  141.       Hstr := Hstr + ConstStr(InfoZe[1],i) + ConstStr(InfoZe[2],10-i) + '< '
  142.                    + SFillStr(5,B1,Bstr) + ' Baud  ' +
  143.                    + EFillStr(10,B1,Tstr) +
  144.                    + CoStr + '/' + GrStr;
  145.  
  146.       InfoOut(Kanal,0,0,Hstr);
  147.       if DateiInfo = 2 then BoxZaehl := $FFFF;
  148.     end;
  149.   end;
  150. End;
  151.  
  152.  
  153. Function  Zeit_to_Sek (* Zeile : str8) : LongInt *);
  154. var  l : LongInt;
  155. Begin
  156.   if (Zeile[3] = DP) and (Zeile[6] = DP) then
  157.   begin
  158.     l := str_int(copy(Zeile,1,2)) * 3600;
  159.     l := l + str_int(copy(Zeile,4,2)) * 60;
  160.     l := l + str_int(copy(Zeile,7,2));
  161.     Zeit_to_sek := l;
  162.   end else Zeit_to_sek := 0;
  163. End;
  164.  
  165.  
  166. Function Time_Differenz (* Start,Stop : Str8) : Str8 *);
  167. Var    l,l1 : LongInt;
  168.        Bstr,
  169.        Hstr : String[8];
  170.  
  171. Begin
  172.   l  := Zeit_to_sek(Start);
  173.   l1 := Zeit_to_sek(Stop);
  174.   if l1 < l then l1 := l1 + 86400;
  175.   l := l1 - l;
  176.   Bstr := '';
  177.   Hstr := int_str(l div 3600);
  178.   While length(Hstr) < 2 do Hstr := '0' + Hstr;
  179.   Bstr := Bstr + Hstr + DP;
  180.   l := l mod 3600;
  181.   Hstr := int_str(l div 60);
  182.   While length(Hstr) < 2 do Hstr := '0' + Hstr;
  183.   Bstr := Bstr + Hstr + DP;
  184.   l := l mod 60;
  185.   Hstr := int_str(l);
  186.   While length(Hstr) < 2 do Hstr := '0' + Hstr;
  187.   Time_Differenz := Bstr + Hstr;
  188. End;
  189.  
  190.  
  191. Function FileBaud (* ZeitStr,AnzStr : Str9) : Str9 *);
  192. Var  l,l1 : LongInt;
  193. Begin
  194.   l := Zeit_to_sek(ZeitStr);
  195.   if l = 0 then l := 1;
  196.   l1 := str_int(AnzStr) * 8;
  197.   FileBaud := int_str(Round(l1 / l));
  198. End;
  199.  
  200.  
  201. Procedure Kill_Save_File (* Kanal : Byte *);
  202. var    Flag   : Boolean;
  203. Begin
  204.   with K[Kanal]^ do
  205.   begin
  206.     if ResetBin(SFile,T) = 0 then
  207.     begin
  208.       if Save then
  209.       begin
  210.         Seek(SFile,0);
  211.         Truncate(SFile);
  212.         G^.Fstr[15] := InfoZeile(299);
  213.       end else
  214.       begin
  215.         FiResult := CloseBin(SFile);
  216.         if EraseBin(SFile) = 0 then G^.Fstr[15] := InfoZeile(297)
  217.                                else G^.Fstr[15] := InfoZeile(296);
  218.       end;
  219.     end else G^.Fstr[15] := InfoZeile(298);
  220.  
  221.     Alarm;
  222.     G^.Fstr[15] := G^.Fstr[15] + '  ' + InfoZeile(78);
  223.     Fenster;
  224.     SetzeCursor(length(G^.Fstr[15])+2,15);
  225.     Warten;
  226.     Cursor_aus;
  227.   end;
  228. End;
  229.  
  230.  
  231. Procedure Close_SaveFiles;
  232. var   i : Byte;
  233. Begin
  234.   for i := 0 to maxLink do with K[i]^ do
  235.   begin
  236.     if Save    and (FileRec(SFile).Mode   <> fmClosed) then FiResult := CloseBin(SFile);
  237.     if RX_Save and (FileRec(RxFile).Mode  <> fmClosed) then FiResult := CloseBin(RxFile);
  238.     if SplSave and (FileRec(SplFile).Mode <> fmClosed) then FiResult := CloseBin(SplFile);
  239.   end;
  240. End;
  241.  
  242.  
  243. Procedure Open_SaveFiles;
  244. var   i : Byte;
  245. Begin
  246.   for i := 0 to maxLink do with K[i]^ do
  247.   begin
  248.     if Save and (FileRec(SFile).Mode = fmClosed) then
  249.     begin
  250.       if ResetBin(SFile,T) = 0 then Seek(SFile,FileSize(SFile)) else
  251.       begin
  252.         Save := false;
  253.         Triller;
  254.       end;
  255.     end;
  256.  
  257.     if RX_Save and (FileRec(RxFile).Mode = fmClosed) then
  258.     begin
  259.       if ResetBin(RxFile,T) = 0 then Seek(RxFile,FileSize(RxFile)) else
  260.       begin
  261.         RX_Save := false;
  262.         RX_Bin := 0;
  263.         Triller;
  264.       end;
  265.     end;
  266.  
  267.     if SplSave and (FileRec(SplFile).Mode = fmClosed) then
  268.     begin
  269.       if ResetBin(SplFile,T) = 0 then Seek(SplFile,FileSize(SplFile)) else
  270.       begin
  271.         SplSave := false;
  272.         Triller;
  273.       end;
  274.     end;
  275.   end;
  276. End;
  277.  
  278.  
  279. Procedure Neu_Name (* Kanal,Art : Byte; Call : str9; Name : str19 *);
  280. var   Result : Word;
  281.       B      : Byte;
  282.       i,i1   : Integer;
  283.       f      : Text;
  284.       Hstr   : string[31];
  285.       Bstr   : string[80];
  286.       flag,
  287.       Loesch : Boolean;
  288. Begin
  289.   B := K[Kanal]^.Umlaut;
  290.   Call := EFillStr(9,B1,UpCaseStr(Call));
  291.   KillEndBlanks(Name);
  292.   i := 1;
  293.   File_Umbenennen(SysPfad + NamesDatei,SysPfad + TmpDatei,i,i1);
  294.   Assign(f,SysPfad + TmpDatei);
  295.   FiResult := ResetTxt(f);
  296.   Assign(G^.TFile,SysPfad + NamesDatei);
  297.   FiResult := RewriteTxt(G^.TFile);
  298.   flag := false;
  299.   Loesch := false;
  300.  
  301.   While not Eof(f) do
  302.   begin
  303.     Readln(f,Hstr);
  304.     if not flag and (copy(Hstr,3,9) = Call) then
  305.     begin
  306.       flag := true;
  307.       Hstr := Hex(B,1) + B1 + Call + DP + Name;
  308.       Result := 1;
  309.       if Name = '' then
  310.       begin
  311.         Result := 2;
  312.         Loesch := true;
  313.       end;
  314.     end;
  315.     if not flag and (copy(Hstr,3,9) > Call) and (Name <> '') then
  316.     begin
  317.       flag := true;
  318.       Writeln(G^.TFile,Hex(B,1),B1,Call,DP,Name);
  319.       Result := 0;
  320.     end;
  321.     if not Loesch then Writeln(G^.TFile,Hstr);
  322.     Loesch := false;
  323.   end; (* While *)
  324.  
  325.   if not flag then
  326.   begin
  327.     if Name > '' then Writeln(G^.TFile,Hex(B,1),B1,Call,DP,Name);
  328.     flag := true;
  329.     Result := 0;
  330.     if Name = '' then
  331.     begin
  332.       Result := 3;
  333.       Loesch := true;
  334.     end;
  335.   end;
  336.  
  337.   FiResult := CloseTxt(G^.TFile);
  338.   FiResult := CloseTxt(f);
  339.   FiResult := EraseTxt(f);
  340.   case Result of
  341.     0 : Bstr := InfoZeile(10);    (* Hinzu          *)
  342.     1 : Bstr := InfoZeile(11);    (* geändert       *)
  343.     2 : Bstr := InfoZeile(250);   (* gelöscht       *)
  344.     3 : Bstr := InfoZeile(251);   (* Nicht gefunden *)
  345.     else Triller;
  346.   end;
  347.   Bstr := Name + B1 + '->' + B1 + Bstr;
  348.   if Art = 1 then G^.DZeile := Bstr else InfoOut(Kanal,0,1,Bstr);
  349.   if (Result = 3) and (Art = 0) then Alarm;
  350. End;
  351.  
  352.  
  353. Function  GetName (* Kanal : Byte; Call : str9; var FlagByte : Byte) : Str40; *);
  354. Const  maxB = $F000;
  355. Var    Flag,
  356.        Found : Boolean;
  357.        Nstr,
  358.        Hstr  : String[31];
  359.        Cstr,
  360.        Pstr  : String[9];
  361.        Zahl  : LongInt;
  362. Begin
  363.   Found := false;
  364.   Flag := false;
  365.   Nstr := '';
  366.   KillEndBlanks(Call);
  367.   Pstr := Call;
  368.   Strip(Pstr);
  369.   Assign(G^.TFile,SysPfad + NamesDatei);
  370.   FiResult := ResetTxt(G^.TFile);
  371.   Repeat
  372.     Readln(G^.TFile,Hstr);
  373.     Cstr := CutStr(copy(Hstr,3,9));
  374.     Strip(Cstr);
  375.  
  376.     if Pstr = Cstr then
  377.     begin
  378.       if Call = CutStr(copy(Hstr,3,9)) then Found := true;
  379.       if not Flag or Found then
  380.       begin
  381.         FlagByte := Byte(str_int('$'+ Hstr[1]));
  382.         if not (FlagByte in UmlMenge) then FlagByte := 0;
  383.         delete(Hstr,1,pos(DP,Hstr));
  384.         KillEndBlanks(Hstr);
  385.         Nstr := Hstr;
  386.         Flag := true;
  387.       end;
  388.     end;
  389.   Until Found or Eof(G^.TFile);
  390.  
  391.   if Nstr > '' then GetName := Nstr else
  392.   begin
  393.     GetName := '';
  394.     FlagByte := K[Kanal]^.UmlautMerk;
  395.   end;
  396.   FiResult := CloseTxt(G^.TFile);
  397. end;
  398.  
  399.  
  400. Function  Platzhalter (* Kanal : Byte; Zeile : String) : String *);
  401. var    i,Nr : Byte;
  402.        Hstr : String[80];
  403.        Bstr : String;
  404. Begin
  405.   with K[Kanal]^ do
  406.   begin
  407.     Bstr := '';
  408.     While pos('%',Zeile) > 0 do
  409.     begin
  410.       i := pos('%',Zeile);
  411.       Bstr := Bstr + copy(Zeile,1,i-1);
  412.       delete(Zeile,1,i-1);
  413.       Hstr := copy(Zeile,1,3);
  414.       delete(Zeile,1,3);
  415.       Nr := Byte(str_int(copy(Hstr,2,2)));
  416.  
  417.       Case Nr of
  418.         1 : Hstr := Uhrzeit;
  419.         2 : Hstr := Datum;
  420.         3 : Hstr := User_Name;
  421.         4 : Hstr := int_str(Kanal);
  422.         5 : Hstr := Call;
  423.         6 : Hstr := Platzhalter(Kanal,G^.PromptStr);
  424.         7 : Hstr := Zeitart;
  425.         8 : Hstr := OwnCall;
  426.         9 : Hstr := TNC[TncNummer]^.Ident;
  427.        10 : Hstr := Version;
  428.        11 : Hstr := lastEdit;
  429.        12 : Hstr := copy(Uhrzeit,1,5);
  430.        13 : Hstr := RestStr(Datum);
  431.        14 : Hstr := CutStr(Datum);
  432.        15 : if User_Name = '' then Hstr := Call
  433.                               else Hstr := User_Name;
  434.        16 : if User_Name = '' then Hstr := InfoZeile(131)
  435.                               else Hstr := '';
  436.        17 :;
  437.        18 : Hstr := ^G;
  438.        19 : Hstr := M1;
  439.        20 : Hstr := int_str(TncNummer);
  440.        21 :;
  441.        22 : begin
  442.               Hstr := Call;
  443.               Strip(Hstr);
  444.             end;
  445.        23 : Hstr := WochenTag;
  446.        24 : Hstr := ^Z;
  447.        25 :;
  448.        26 : Hstr := QSO_Begin;
  449.        27 : Hstr := QSO_Time(Kanal);
  450.        28 : Hstr := int_str(CNr);
  451.        29 : begin
  452.               Hstr := OwnCall;
  453.               Strip(Hstr);
  454.             end;
  455.        30 : Hstr := TNC[TncNummer]^.QRG_Akt;
  456.       end;
  457.  
  458.       Bstr := Bstr + Hstr;
  459.     end;
  460.     Platzhalter := Bstr + Zeile;
  461.   end;
  462. End;
  463.  
  464.  
  465. Function  MakeBinStr (* Kanal : Byte; Zeile : Str80) : Str80 *);
  466. var   Hstr  : String[80];
  467.       TxPos,
  468.       FTime : LongInt;
  469.       i     : Byte;
  470. Begin
  471.   with K[Kanal]^ do
  472.   begin
  473.     TxPos := FilePos(TxFile);
  474.     KillEndBlanks(Zeile);
  475.     Hstr := Zeile + B1 + SFillStr(1,'0',int_str(TxPos)) + B1 +
  476.             int_str(TxPos + TX_Laenge - 1);
  477.  
  478.     FiResult := CloseBin(TxFile);
  479.     CRC_Datei(Hstr);
  480.     FiResult := ResetBin(TxFile,T);
  481.     GetFtime(TxFile,FTime);
  482.     Seek(TxFile,TxPos);
  483.  
  484.     i := 1;
  485.     While (length(Hstr) > 0) and (not (Hstr[1] in ['0'..'9'])) do delete(Hstr,1,1);
  486.     While (length(Hstr) > 0) and (Hstr[i] in ['0'..'9']) do inc(i);
  487.     Hstr := Meldung[8] + int_str(TX_Laenge) + '#|' + copy(Hstr,1,i-1) +
  488.             '#$' + Hex(FTime,8) + '#' + copy(Zeile,1,2) + BS;
  489.  
  490.     i := length(Zeile);
  491.     While (i > 0) and (not(Zeile[i] in [BS,DP])) do dec(i);
  492.     delete(Zeile,1,i);
  493.  
  494.     if SCon[1] or SCon[2] or not TxLRet then Hstr := M1 + Hstr;
  495.     MakeBinStr := Hstr + Zeile + M1;
  496.   end;
  497. End;
  498.  
  499.  
  500. Function SaveNameCheck (* Art : Byte; Zeile : Str80) : Boolean *);
  501. Var    i    : Byte;
  502.        Flag : Boolean;
  503. Begin
  504.   Flag := true;
  505.   if Art = 1 then
  506.   begin
  507.     While pos(DP,Zeile) > 0 do delete(Zeile,1,pos(DP ,Zeile));
  508.     While pos(BS,Zeile) > 0 do delete(Zeile,1,pos(BS,Zeile));
  509.   end;
  510.   if not FNameOK(Zeile) then Flag := false;
  511.   if pos(Pkt,Zeile) = 0  then Zeile := Zeile + Pkt;
  512.   for i := 1 to length(Zeile) do
  513.       if not (Zeile[i] in ['A'..'Z','0'..'9','Ä','Ö','Ü','!','#','%','&',
  514.                            '.','(',')','-','@','^','_','{','}','$','~'])
  515.                            then Flag := false;
  516.   i := pos(Pkt,Zeile);
  517.   if (i > 9) or (i < 2) then Flag := false;
  518.   delete(Zeile,1,i);
  519.   if (pos(Pkt,Zeile) > 0) or (length(Zeile) > 3) then Flag := false;
  520.   SaveNameCheck := Flag;
  521. End;
  522.  
  523.  
  524. Function  MakePathName (* Kanal : Byte; Var DFlag : Boolean; Zeile : Str80) : Str80 *);
  525. Var  i : Byte;
  526. Begin
  527.   with K[Kanal]^ do
  528.   begin
  529.     DFlag := false;
  530.  
  531.     if (pos(DP,Zeile) = 0) and (pos(BS,Zeile) <> 1) then Zeile := RemPath + Zeile;
  532.     if pos(BS,Zeile) = 1 then Zeile := copy(RemPath,1,2) + Zeile;
  533.  
  534.     i := pos(BS+DpP,Zeile);
  535.     if i > 0 then
  536.     begin
  537.       while i > 0 do
  538.       begin
  539.         delete(Zeile,i,3);
  540.         dec(i);
  541.         Repeat
  542.           delete(Zeile,i,1);
  543.           if i > 0 then dec(i);
  544.         Until (i = 0) or (Zeile[i] = BS);
  545.         if (i > 0) and (Zeile[i] = BS) then delete(Zeile,i,1);
  546.         i := pos(BS+DpP,Zeile);
  547.       end;
  548.     end;
  549.  
  550.     if not RemAll then
  551.     begin
  552.       if (pos(G^.Drive,Zeile) = 1) or
  553.          (use_RomLw and (pos(RomDisk,Zeile) = 1)) then DFlag := true;
  554.     end else DFlag := true;
  555.  
  556.     if not FNameOk(Zeile) then DFlag := false;
  557.     MakePathName := Zeile;
  558.   end;
  559. End;
  560.  
  561.  
  562. Function FNameOK (* Zeile : Str80) : Boolean *);
  563. Var   i    : Byte;
  564.       Flag : Boolean;
  565. Begin
  566.   i := 0;
  567.   Flag := true;
  568.  
  569.   While pos(Pkt,Zeile) > 0 do
  570.   begin
  571.     i := pos(Pkt,Zeile);
  572.     Zeile[i] := BS;
  573.   end;
  574.  
  575.   if i = 0 then i := length(Zeile) + 2
  576.            else inc(i);
  577.   Zeile := copy(BS+Zeile+BS,1,i);
  578.  
  579.   for i := 1 to maxNoneName do
  580.    if pos(BS+NoneNames[i]+BS,Zeile) > 0 then Flag := false;
  581.   FNameOK := Flag;
  582. End;
  583.  
  584.  
  585. Function  PfadOk (* (Art : Byte; Zeile : Str80) : Boolean *);
  586. Var       f      : Text;
  587.           Hstr   : String[80];
  588.           Result : Integer;
  589. Begin
  590.   case Art of
  591.     0 : begin
  592.           GetDir(0,Hstr);
  593.           if Zeile[length(Zeile)] = BS then delete(Zeile,length(Zeile),1);
  594.           (*$I-*) ChDir(Zeile); (*$I+*)
  595.           Result := IOResult;
  596.           PfadOk := (Result = 0);
  597.           ChDir(Hstr);
  598.         end;
  599.  
  600.     1 : begin
  601.           if not Exists(Zeile) then
  602.           begin
  603.             Assign(f,Zeile);
  604.             if RewriteTxt(f) = 0 then
  605.             begin
  606.               FiResult := CloseTxt(f);
  607.               FiResult := EraseTxt(f);
  608.               PfadOk := true;
  609.             end else PfadOk := false;
  610.           end else PfadOk := true;
  611.         end;
  612.  
  613.     2 : begin
  614.           if Zeile[length(Zeile)] <> BS then Zeile := Zeile + BS;
  615.           Zeile := Zeile + Testname;
  616.           if not Exists(Zeile) then
  617.           begin
  618.             Assign(f,Zeile);
  619.             if RewriteTxt(f) = 0 then
  620.             begin
  621.               FiResult := CloseTxt(f);
  622.               FiResult := EraseTxt(f);
  623.               PfadOk := true;
  624.             end else PfadOk := false;
  625.           end else PfadOk := true;
  626.         end;
  627.   end;
  628. End;
  629.  
  630.  
  631. Function  MkSub (* Pfad : Str80) : Boolean *);
  632. Var   Hstr,
  633.       Merk    : String[80];
  634.       Z,i     : Byte;
  635.       Result  : Word;
  636.  
  637. Begin
  638.   Pfad := UpCaseStr(Pfad);
  639.   KillEndBlanks(Pfad);
  640.   While Pfad[length(Pfad)] = BS do delete(Pfad,length(Pfad),1);
  641.   Merk := Pfad;
  642.   if pos(DP+BS,Pfad) = 2 then
  643.   begin
  644.     Z := 0;
  645.     Hstr := '';
  646.     Pfad := Pfad + BS;
  647.     While length(Pfad) > 0 do
  648.     begin
  649.       inc(Z);
  650.       i := pos(BS,Pfad);
  651.       Hstr := Hstr + copy(Pfad,1,i-1);
  652.       if Z > 1 then
  653.       begin
  654.         (*$I-*) MkDir(Hstr); (*$I+*)
  655.         Result := IOResult;
  656.       end;
  657.       Hstr := Hstr + BS;
  658.       delete(Pfad,1,i);
  659.     end;
  660.   end else
  661.   begin
  662.     (*$I-*) MkDir(Pfad); (*$I+*)
  663.     Result := IOResult;
  664.   end;
  665.   Pfad := Merk;
  666.   MkSub := PfadOk(2,Pfad);
  667. End;
  668.  
  669.  
  670. Procedure KillFile (* Zeile : Str80 *);
  671. Var   f      : Text;
  672.       Result : Word;
  673. Begin
  674.   Assign(f,Zeile);
  675.   FiResult := EraseTxt(f);
  676. End;
  677.  
  678.  
  679. Procedure Ini_RemPath;
  680. Var    i : Byte;
  681. Begin
  682.   for i := 0 to maxLink do K[i]^.RemPath := G^.Drive;
  683. End;
  684.  
  685.  
  686. Procedure File_Bearbeiten (* Kanal : Byte; Zeile : Str80 *);
  687. Const  ArtMax = 5;
  688. Var    KC   : Sondertaste;
  689.        VC   : Char;
  690.        Flag : Boolean;
  691.        i,
  692.        X,Y,
  693.        Art  : Byte;
  694.        w    : Word;
  695.        Hstr : String[80];
  696.  
  697.   Procedure Menu;
  698.   Var  i : Byte;
  699.   Begin
  700.     for i := 9 to 15 do G^.Fstx[i] := 2;
  701.     G^.Fstr[7] := InfoZeile(66);
  702.     G^.Fstr[9] := InfoZeile(67);
  703.     G^.Fstr[10] := InfoZeile(68);
  704.     G^.Fstr[11] := InfoZeile(69);
  705.     G^.Fstr[12] := InfoZeile(70);
  706.     G^.Fstr[13] := InfoZeile(71);
  707.     G^.Fstr[14] := '';
  708.     G^.Fstr[15] := '';
  709.   End;
  710.  
  711. Begin
  712.   with K[Kanal]^ do
  713.   begin
  714.     Flag := false;
  715.  
  716.     Zeile := RestStr(UpCaseStr(Zeile));
  717.     Hstr := CutStr(Zeile);
  718.  
  719.     if Hstr = FileParm[1] then Art := 1 else
  720.      if Hstr = FileParm[2] then Art := 2 else
  721.       if Hstr = FileParm[3] then Art := 3 else
  722.        if Hstr = FileParm[4] then Art := 4 else
  723.         if Hstr = FileParm[5] then Art := 5 else
  724.         begin
  725.           Art := 0;
  726.           Zeile := '';
  727.         end;
  728.  
  729.     Zeile := RestStr(Zeile);
  730.  
  731.     if Art = 0 then
  732.     begin
  733.       Menu;
  734.       Art := 1;
  735.  
  736.       Repeat
  737.         for i := 9 to 13 do
  738.         begin
  739.           G^.Fstr[i][vM+1] := B1;
  740.           G^.Fstr[i][vM] := B1;
  741.         end;
  742.  
  743.         X := vM;
  744.         Y := Art + 8;
  745.         G^.Fstr[Y][X] := A_ch;
  746.  
  747.         if HardCur then SetzeCursor(X+1,Y);
  748.  
  749.         G^.Fstr[14] := '';
  750.         G^.Fstr[15] := '';
  751.         Fenster;
  752.  
  753.         _ReadKey(KC,VC);
  754.         Case KC of
  755.           _Esc : begin
  756.                    Art := 0;
  757.                    Flag := true;
  758.                  end;
  759.  
  760.          _AltH : TOP_Help(G^.OHelp[7]);
  761.  
  762.           _Ret : Flag := true;
  763.  
  764.            _F1 : begin
  765.                    Art := 1;
  766.                    Flag := true;
  767.                  end;
  768.  
  769.            _F2 : begin
  770.                    Art := 2;
  771.                    Flag := true;
  772.                  end;
  773.  
  774.            _F3 : begin
  775.                    Art := 3;
  776.                    Flag := true;
  777.                  end;
  778.  
  779.            _F4 : begin
  780.                    Art := 4;
  781.                    Flag := true;
  782.                  end;
  783.  
  784.            _F5 : begin
  785.                    Art := 5;
  786.                    Flag := true;
  787.                  end;
  788.  
  789.            _Up : if Art > 1  then dec(Art)
  790.                              else Alarm;
  791.  
  792.            _Dn : if Art < ArtMax then inc(Art)
  793.                                  else Alarm;
  794.        _Andere : case VC of
  795.                    B1 : Flag := true;
  796.                    else Alarm;
  797.                  end;
  798.            else Alarm;
  799.         End;
  800.       Until Flag;
  801.       ClrFenster;
  802.     end;
  803.  
  804.     VC := #0;
  805.  
  806.     if (Art > 1) and ((pos(Pkt,Zeile) = 0) or (pos(S_ch,Zeile) > 0)) then
  807.     begin
  808.       if Zeile = '' then Zeile := G^.SavePfad;
  809.       if (Zeile[length(Zeile)] <> BS) and (pos(S_ch,Zeile) = 0)
  810.        then Zeile := Zeile + BS;
  811.       DirZeig(Zeile,VC,true);
  812.       if VC <> Esc then
  813.       begin
  814.         VorWrite[Kanal]^[K[Kanal]^.stC] := S_ch + B1 +
  815.           UpCaseStr(ParmStr(2,B1,VorWrite[Kanal]^[K[Kanal]^.stC]) + B1 +
  816.           FileParm[Art] + B1 + Zeile);
  817.       end;
  818.       Cursor_aus;
  819.       Neu_Bild;
  820.     end;
  821.  
  822.     if VC <> Esc then
  823.     begin
  824.       if Art = 1 then
  825.       begin
  826.         Menu;
  827.         G^.Fstr[9][vM] := S_ch;
  828.         Fenster;
  829.         if Zeile > '' then Hstr := Zeile
  830.                       else Hstr := G^.SavePfad + VorWriteDatei +
  831.                            SFillStr(3,'0',int_str(Kanal));
  832.         GetString(Hstr,Attrib[3],60,2,15,KC,1,Ins);
  833.         if KC <> _Esc then
  834.         begin
  835.           Assign(G^.TFile,Hstr);
  836.           FiResult := ResetTxt(G^.TFile);
  837.           if FiResult = 0 then
  838.           begin
  839.             FiResult := CloseTxt(G^.TFile);
  840.             FiResult := AppendTxt(G^.TFile);
  841.           end else FiResult := RewriteTxt(G^.TFile);
  842.  
  843.           if FiResult = 0 then
  844.           begin
  845.             for w := 1 to VorZeilen - VorCmdZeilen do
  846.             begin
  847.               Hstr := VorWrite[Kanal]^[w];
  848.               While pos(#26,Hstr) > 0 do
  849.               begin
  850.                 i := pos(#26,Hstr);
  851.                 Hstr[i] := 'Z';
  852.                 insert('^',Hstr,i);
  853.               end;
  854.               Writeln(G^.TFile,Hstr);
  855.             end;
  856.             Flag := true;
  857.             FiResult := CloseTxt(G^.TFile);
  858.           end else Alarm;
  859.         end;
  860.         Neu_Bild;
  861.       end else
  862.  
  863.       if Art = 2 then
  864.       begin
  865.         if Exists(Zeile) then
  866.         begin
  867.           Assign(G^.TFile,Zeile);
  868.           FiResult := ResetTxt(G^.TFile);
  869.           if Vor_im_EMS then EMS_Seite_einblenden(Kanal,Vor);
  870.           for w := 1 to VorZeilen - VorCmdZeilen do
  871.            Readln(G^.TFile,VorWrite[Kanal]^[w]);
  872.           FiResult := CloseTxt(G^.TFile);
  873.         end else Alarm;
  874.         Neu_Bild;
  875.       end else
  876.  
  877.       if Art = 3 then
  878.       begin
  879.         if Exists(Zeile) then
  880.         begin
  881.           Assign(G^.TFile,Zeile);
  882.           FiResult := ResetTxt(G^.TFile);
  883.           Write_Notiz(Kanal);
  884.           While not Eof(G^.TFile) do
  885.           begin
  886.             Readln(G^.TFile,NZeile);
  887.             KillEndBlanks(NZeile);
  888.             NZeile := M1 + chr(ChAttr(Attrib[20])) + copy(NZeile,1,80);
  889.             Write_Notiz(Kanal);
  890.           end;
  891.           FiResult := CloseTxt(G^.TFile);
  892.           _aus(Attrib[20],Kanal,M1);
  893.         end else Alarm;
  894.         Neu_Bild;
  895.       end else
  896.  
  897.       if Art = 4 then
  898.       begin
  899.         Moni_Off(0);
  900.         Teil_Bild_Loesch(1,maxZ,0);
  901.         Cursor_ein;
  902.         if pos(BS,Zeile) = 0 then Zeile := G^.SavePfad + Zeile;
  903.         Zeile := UpCaseStr(Zeile);
  904.         ExecDOS(G^.Ext_Edi_Path + B1 + Zeile);
  905.         Cursor_aus;
  906.         Moni_On;
  907.         Neu_Bild;
  908.       end else
  909.  
  910.       if Art = 5 then
  911.       begin
  912.         if Exists(CutStr(Zeile)) then
  913.         begin
  914.           CRC_Datei(Zeile);
  915.           InfoOut(Kanal,0,1,Zeile);
  916.         end else InfoOut(Kanal,1,1,CutStr(Zeile) + DP + B1 + InfoZeile(162));
  917.       end else Neu_Bild;
  918.     end;
  919.     ClrFenster;
  920.   end;
  921. End;
  922.  
  923.